package com.nchu.chatserver.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nchu.chatserver.dao.LoginDTO;
import com.nchu.chatserver.entity.Message;
import com.nchu.chatserver.entity.User; // 确保导入的是你自己的User类
import com.nchu.chatserver.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public void setIp(Integer userId, String ip) {
        User user = userMapper.selectById(userId);
        user.setIp(ip); // 设置要更新的IP字段
    }
    @Override
    public void setIsOnline(Integer userId, Boolean status) {
        User user = userMapper.selectById(userId);
        user.setIsOnline(false); // 设置要更新的在线状态字段
    }



}